﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Milo.Tests.Mock.Controls
{
	using Framework;

	public class ArrayContainerControl : ListControl<ArrayContainer>, IListControl<ArrayContainer>
	{
		#region constructors
		public ArrayContainerControl() { }
		public ArrayContainerControl(ArrayContainer model) : base(model) { }
		public ArrayContainerControl(string name, ArrayContainer model) : base(name, model) { }
		#endregion

		private ControlList<string, FieldControl<string>> stringArray;
		private ControlList<SimpleType, SimpleTypeControl> simpleTypeArray;

		public ControlList<string, FieldControl<string>> StringArray
		{
			get
			{
				if (stringArray == null)
				{
					stringArray = new ControlList<string, FieldControl<string>>();
					stringArray.LinkToParent("StringArray", this, get_StringArray_value, set_StringArray_value, 0);
				}
				return stringArray;
			}
		}
		public ControlList<SimpleType, SimpleTypeControl> SimpleTypeArray
		{
			get
			{
				if (simpleTypeArray == null)
				{
					simpleTypeArray = new ControlList<SimpleType, SimpleTypeControl>();
					simpleTypeArray.LinkToParent("SimpleTypeArray", this, get_SimpleTypeArray_value, set_SimpleTypeArray_value, 0);
				}
				return simpleTypeArray;
			}
		}

		private IList<string> get_StringArray_value(int index) { return Value.StringArray; }
		private void set_StringArray_value(IList<string> value, int index) { Value.StringArray = value; }
		private IList<SimpleType> get_SimpleTypeArray_value(int index) { return Value.SimpleTypeArray; }
		private void set_SimpleTypeArray_value(IList<SimpleType> value, int index) { Value.SimpleTypeArray = value; }

	}
}
